#pragma once

class CSvrMemBlock
{
public:
    ~CSvrMemBlock();

    CSvrMemBlock(CSvrMemBlock &) = delete;
    CSvrMemBlock &operator=(const CSvrMemBlock &) = delete;
    CSvrMemBlock &operator=(CSvrMemBlock &&rhs) = delete;

private:
    CSvrMemBlock();

public:
    static CSvrMemBlock *Create(int iLen);
    static CSvrMemBlock *GetInstance() { return m_smb; }
    void Destroy();

    void *Alloc(int iLen);
    void Free(void *ptr);

private:
    static int m_id;
    static CSvrMemBlock *m_smb;

    void *m_pBlock;
    int m_iLen;
    int m_iCur;
};
